window.onload = () => {
  getRem(400, 100);
};
window.onresize = () => {
  getRem(400, 100);
};

function getRem(pwidth, prem) {
  let html = document.querySelector('html');
  let oWidth =
    document.body.clientWidth || document.documentElement.clientWidth;
  html.style.fontSize = (oWidth / pwidth) * prem + 'px';
}
